package quotation.web.invite.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import quotation.R.R;
import quotation.web.invite.ddd.form.GenerateForm;
import quotation.web.invite.service.InviteService;

import javax.validation.Valid;

/**
 * @author lyx
 * @date 2025/2/24
 */
@RestController
@RequestMapping(value = "/invite")
public class InviteController {

    @Autowired
    private InviteService inviteService;


    @PostMapping("/generate")
    @ApiOperation("生成邀请码")
    public R<String> generate(@RequestBody @Valid GenerateForm form) {

        String code = inviteService.generate(form);
        return R.success("生成成功", code);
    }
}
